package seu.evaluation.metric;

import java.util.ArrayList;
import java.util.Map;

/**
 * 
 * @author cli
 * 度量抽象基类
 * 子类继承该类实现具体度量，如可维护性、可靠性等
 * getReulsts():将度量结果返回给上级
 * showResults():显示结果
 * 
 *
 */
public class Metric {

	protected ArrayList<MetricResult> results;

	public Metric(){
		results = new ArrayList<MetricResult>();
	}
	
	public ArrayList<MetricResult> getResults(){
		return this.results;
	}
	
	public void showResults()
	{	
		for(MetricResult mr : results)
		{
			String temp = "";
			temp += "title: "+mr.getTitle()+"\n";
			temp += "type: "+mr.getType()+"\n";
			temp += "date: "+mr.getDate()+"\n";
			temp +="finalResult: "+ mr.getFinalResult() +"\n\n";
			
			 for (Map.Entry<String,Object> entry : mr.getSubResult().entrySet()) {
				 temp += ("component"+entry.getKey().toString()
						 +":"+ entry.getValue() +"\n");
		     }
			 System.out.println(temp);
		}	
	}

}
